Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/decrypt token #39

Closed
wants to merge 8 commits into from
Closed

Feature/decrypt token #39

wants to merge 8 commits into from

Conversation

juuso-j
Copy link
Collaborator

@juuso-j juuso-j commented Mar 15, 2024

Decrypt token

Description

trello #89

Breakdown:

Files changed

  1. config_dev.env.example
  2. mpbackend/settings.py
    • Add TOKEN_SECRET
  3. requirements.txt
  4. requirements.in
    • Add pycryptodome
  5. account/tests/test_api.py
    • Remove obsolete comment
  6. profiles/api/utils.py
    • Add decrtypt_text function
  7. profiles/api/views.py
    • Decrypt token
  8. profiles/tests/api/test_postal_code_result.py
    • Replace start_poll requests with token creation

@juuso-j juuso-j added the enhancement New feature or request label Mar 15, 2024
@juuso-j juuso-j requested a review from ezkat March 15, 2024 07:47
@juuso-j juuso-j self-assigned this Mar 15, 2024
def decrypt_text(text, key):
text = pad(text.encode(), 16)
cipher = AES.new(key.encode("utf-8"), AES.MODE_ECB)
return base64.b64encode(cipher.encrypt(text))

Check failure

Code scanning / CodeQL

Use of a broken or weak cryptographic algorithm High

The block mode ECB
is broken or weak, and should not be used.
@juuso-j juuso-j closed this Mar 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant